<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://www.layuicdn.com/auto/layui.js" v="2.5.6" e="layui"></script>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<form action="" class="layui-form" method="post" lay-filter="dataFrm" id="dataFrm">
        <table class="layui-hide" lay-filter="Table" id="Table"></table>
        <div class="layui-input-block" id="Bar" style="display: none;">
            <input type="button" class="layui-btn layui-btn-normal layui-btn-sm layui-icon layui-icon-release" lay-filter="sub" lay-submit="" value="提交" id="btnSubmit" >
            <button type="reset" class="layui-btn layui-btn-warm layui-btn-sm layui-icon layui-icon-refresh" >重置</button>
        </div>
    <!--<input type=button id="btnSubmit" disabled value="已提交">-->
   <!-- <input type=button id="btnSubmit" class="layui-btn layui-btn-normal layui-btn-sm layui-icon layui-icon-release" lay-filter="sub" lay-submit="" value="提交">-->
</form>
<script type="text/javascript">
    layui.use(['layer', 'table','form', 'laydate' ], function() {
        var layer = layui.layer;
        var form = layui.form;
        var laydate = layui.laydate;
        var table = layui.table;
        //绑定时间选择器


        table.render({
            elem: '#Table'   //渲染的目标对象
            , url: '/course/selectk' //数据接口
            , title: '课程'//数据导出来的标题
            , toolbar: "#ToolBar"
            , height: 'full-350'
            , cellMinWidth: 100 //设置列的最小默认宽度
            , limits: [3, 5, 10]  //一页选择显示3,5或10条数据
            , limit: 10  //一页显示10条数据
            , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据，res为从url中get到的数据
                var result;
                console.log(this);
                console.log(JSON.stringify(res));
                if (this.page.curr) {
                    result = res.data.slice(this.limit * (this.page.curr - 1), this.limit * this.page.curr);
                } else {
                    result = res.data.slice(0, this.limit);
                }
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.count, //解析数据长度
                    "data": result //解析数据列表
                };
            }
            , done: function (res, curr, count) {
            }
            , page: true  //是否启用分页
            , cols: [[   //列表数据
                {type: 'checkbox', fixed: 'left'}
                , {field: 'k_id', title: '', sort: true, align: 'center'}
                , {field: 'k_num', title: '编号', sort: true, align: 'center'}
                , {field: 'k_name', title: '课程名字', align: 'center'}
                , {field: 'k_time', title: '课程时间', align: 'center'}
                , {field: 'j_name', title: '教练', align: 'center'}
                , {fixed: 'right', title: '操作', toolbar: '#Bar', width: 220, align: 'center'}
            ]]
        })



    $(document).ready(function(){
        $("#btnSubmit").click(function(){

            setTimeout(function(){
                $("#btnSubmit").val("提交！");
                //按钮变成不可点击
                $("#btnSubmit").attr("disabled", "disabled");
            });
        });
    });
</script>

</body>
</html>